package xkp.lesson.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 负责连接数据库
 */
public class DBConnection {

    public static Connection getConnection() throws SQLException {
         Connection connection = null;
        if(connection == null){
            String url = "jdbc:mysql://192.168.93.59:3306/day37?" +
                    "characterEncoding=UTF-8&rewriteBatchedStatements=true";
            String user = "root";
            String password = "123456";
            //String driver = "com.mysql.jdbc.Driver";
            connection = DriverManager.getConnection(url,user,password);
        }
        return connection;
    }

}
